<?xml version='1.0' encoding='UTF-8' ?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	template="/templates/ui.xhtml">
	<ui:define name="styleAndScript">
		<style>
			.ui-calendar-inputStyle {width:10px !important;}
		</style>
	</ui:define>
	<ui:define name="content">
		<p:panel styleClass="panel1" id="panelFirst" >
			<h:form prependId="false" id="userinfoFormId">
				<p:growl id="growl"  sticky="true"/>
				<div style="margin-top: 7px; margin-bottom: 7px;">
					<p:breadCrumb >
						<p:menuitem value="首页" url="/faces/index.xhtml" />
						<p:menuitem value="用户管理" url="#" />
						<p:menuitem value="用户信息管理" url="/faces/usermanage/userdata/index.xhtml" />
					</p:breadCrumb>
				</div>
				
				<div class="style1" >
					<h:panelGrid columns="8" id="serachPanelId" style="margin-top: 5px; margin-bottom: 5px;" 
						columnClasses="column1,column2,column1,column2,column1,column2,column1,column2">
						<h:outputLabel value="帐号:" />
						<p:inputText value="#{userinfoBean.whereExMap['account']}" />
						
						<h:outputLabel value="真实姓名:"/>
						<p:inputText value="#{userinfoBean.whereExMap['realName']}"  />
						
						<h:outputLabel value="性别:"/>
						<p:selectOneMenu value="#{userinfoBean.whereExMap['sex']}" style="width:130px;">
							<f:selectItem itemLabel="请选择" itemValue="" />
							<f:selectItem itemLabel="男" itemValue="男" />
							<f:selectItem itemLabel="女" itemValue="女" />
						</p:selectOneMenu>
						
						<h:outputLabel value="地址"/>
						<p:inputText value="#{userinfoBean.whereExMap['address']}"/>
						
						<h:outputLabel value="创建时间:"/>
						<p:calendar value="#{userinfoBean.whereExMap['beginTime']}"  locale="cn" pattern="yyyy-MM-dd" />
						
						<h:outputLabel value="到:"/>
						<p:calendar value="#{userinfoBean.whereExMap['endTime']}" locale="cn" pattern="yyyy-MM-dd" />
					</h:panelGrid>

					<div align="right" style="margin-top: 5px; margin-bottom: 5px;">
						<p:commandButton value="查询" icon="ui-icon ui-icon-search" style="margin-right:5px" actionListener="#{userinfoBean.queryUserInfo()}" update=":userinfoFormId:tableId"/>
						<p:commandButton value="重置" icon="ui-icon ui-icon-cancel" style="margin-right:13px" type="reset"/>
					</div>
				</div>
			
				
				<p:dataTable var="ss" value="#{userinfoBean.lazyUser}"   id="tableId" 
					paginatorPosition="bottom" rowIndexVar="index" paginator="true" 
					rows="9"
					paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {CurrentPageReport}" 
					currentPageReportTemplate="#{component.rowCount == 0 ? '0/0' : '{currentPage}/{totalPages}'} "
					style="margin-top: 5px;" emptyMessage="没有数据" >
					<f:facet name="header">
						用户信息列表
						<div style="text-align: right; position: relative; margin: -15px 2px 0px 0px; vertical-align: middle">
							<p:commandButton value="添加" icon="ui-icon ui-icon-plus"  actionListener="#{userinfoBean.resetDlg()}" update=":userdataDlgId"  oncomplete="dialogHeaderValueChange();userdataDlgVar.show();getWidth();"   />
						</div>
					</f:facet>
					<p:column >
						<f:facet name="header">
							<h:outputText value="帐号" />
						</f:facet>
						<h:outputText value="#{ss.account}" />
					</p:column>
					<p:column >
						<f:facet name="header">
							<h:outputText value="密码" />
						</f:facet>
						<h:outputText value="#{ss.password}" />
					</p:column>
					<p:column >
						<f:facet name="header">
							<h:outputText value="真实姓名" />
						</f:facet>
						<h:outputText value="#{ss.realname}" />
					</p:column>
					<p:column style="text-align: center;width:18px;" >
						<f:facet name="header" >
							<h:outputText value="性别" />
						</f:facet>
						<h:outputText value="#{ss.sex}" />
					</p:column>
					<p:column  >
						<f:facet name="header">
							<h:outputText value="Phone" />
						</f:facet>
						<h:outputText value="#{ss.phone}" />
					</p:column>
					<p:column >
						<f:facet name="header">
							<h:outputText value="Email" />
						</f:facet>
						<h:outputText value="#{ss.email}" />
					</p:column>
					<p:column >
						<f:facet name="header">
							<h:outputText value="地址" />
						</f:facet>
						<h:outputText value="#{ss.address}" />
					</p:column>
					<p:column >
						<f:facet name="header">
							<h:outputText value="创建人" />
						</f:facet>
						<h:outputText value="#{ss.createBy}" />
					</p:column  >
					<p:column style="text-align: center;" >
						<f:facet name="header">
							<h:outputText value="创建时间" />
						</f:facet>
						<h:outputText value="#{commonBean.formatDate(ss.createTime)}" />
					</p:column>
					<p:column  >
						<f:facet name="header">
							<h:outputText value="更新人" />
						</f:facet>
						<h:outputText value="#{ss.updateBy}" />
					</p:column>
					<p:column style="text-align: center;"  >
						<f:facet name="header">
							<h:outputText value="更新时间" />
						</f:facet>
						<h:outputText value="#{commonBean.formatDate(ss.updateTime)}" />
					</p:column>
					<p:column style="text-align: center;width:18px;"  >
						<f:facet name="header">
							<h:outputText value="有效" />
						</f:facet>
						<h:outputText value="#{ss.usable eq 'Y'?'是':'否' }" />
					</p:column>
					
					<p:column style="text-align: center;width:18px;">
						<f:facet name="header">
							<h:outputText value="操作" />
						</f:facet>
						<p:commandButton  oncomplete="dialogHeaderValueChangeTwo();userdataDlgVar.show();getWidth();"  
							icon="ui-icon ui-icon-pencil" title="编辑" update=":userdataDlgId"  
							 style="width:18px;height:18px;">
							<f:setPropertyActionListener target="#{userinfoBean.userinfo}" value="#{ss}" />
							<f:setPropertyActionListener target="#{userinfoBean.isModify}" value="true" />
							<f:setPropertyActionListener target="#{userinfoBean.sex}" value="#{ss.sex}" />
							<f:setPropertyActionListener target="#{userinfoBean.usable}" value="#{ss.usable}" />
						</p:commandButton>
					</p:column>
				</p:dataTable>
			</h:form>
			
		</p:panel>
		<script type="text/javascript">
			function dialogHeaderValueChange(){
				userdataDlgVar.titlebar.children('span.ui-dialog-title').html('添加新用户'); 
			}	
			function dialogHeaderValueChangeTwo(){
				userdataDlgVar.titlebar.children('span.ui-dialog-title').html('编辑用户信息'); 
			}
			function removeRedBox(){
				/*$("#in").removeClass("ui-state-error");
				$("div:last").prevAll().removeClass("ui-state-error");
				$("div").children().removeClass("ui-state-error"); */
			    /* $(".ui-state-error").removeClass("ui-state-error"); */
			}
			/* $(":dialog").each(function() {
				$(".ui-state-error").removeClass("ui-state-error");
			 }); */
		</script>
		
	</ui:define>
	<ui:define name="dialog">
		<ui:include src="operate.xhtml"></ui:include>
	</ui:define>
</ui:composition>

